// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import './icons'
import echarts from 'echarts'
import navBar from './components/NavBar.vue'
import VueClipboard from 'vue-clipboard2'
import i18n from './locales/index.js'
import filters from './filters/index.js'
// import Vconsole from 'vconsole'
import Back from './utils/back.js'
import Video from 'video.js'
import 'video.js/dist/video-js.css'
import store from './utils/store.js'
import {
  Button,
  Field,
  NavBar,
  Tabbar,
  TabbarItem,
  Toast,
  Col,
  Row,
  Tab,
  Tabs,
  Search,
  Calendar,
  CountDown,
  Cell,
  CellGroup,
  ImagePreview,
  Form,
  Radio,
  RadioGroup,
  Uploader,
  ActionSheet,
  Dialog,
  Progress,
  DatetimePicker,
  Popup,
  Checkbox,
  CheckboxGroup,
  Card,
  Sidebar,
  SidebarItem,
  Step,
  Steps,
  NoticeBar,
  Swipe,
  SwipeItem,
  ShareSheet,
  DropdownMenu,
  DropdownItem,
  Loading,
  Icon,
  Circle,
  Collapse,
  CollapseItem,
  Notify,
  PullRefresh,
  List
 } from 'vant';
import 'vant/lib/index.css';
// let vConsole = new Vconsole()

// Vue.use(vConsole)
Vue.use(VueClipboard)
Vue.prototype.$video = Video
Vue.prototype.$echarts = echarts
Vue.prototype.$EventBus = new Vue()
Vue.component("nav-bar",navBar);
Vue.use(Field)
.use(Button)
.use(NavBar)
.use(Tabbar)
.use(TabbarItem)
.use(Toast)
.use(Col)
.use(Row)
.use(Tab)
.use(Tabs)
.use(Search)
.use(Calendar)
.use(CountDown)
.use(Cell)
.use(CellGroup)
.use(ImagePreview)
.use(Form)
.use(Radio)
.use(RadioGroup)
.use(Uploader)
.use(ActionSheet)
.use(Dialog)
.use(Progress)
.use(DatetimePicker)
.use(Popup)
.use(Checkbox)
.use(CheckboxGroup)
.use(Card)
.use(Sidebar)
.use(SidebarItem)
.use(Step)
.use(Steps)
.use(NoticeBar)
.use(Swipe)
.use(SwipeItem)
.use(ShareSheet)
.use(DropdownMenu)
.use(DropdownItem)
.use(Loading)
.use(Icon)
.use(Circle)
.use(Collapse)
.use(CollapseItem)
.use(Notify)
.use(PullRefresh)
.use(List);
Vue.config.productionTip = false

Object.keys(filters).forEach(key=>{
    Vue.filter(key,filters[key])//插入过滤器名和对应方法
})

var onPlusReady = function (callback, context = this) {
  if (window.plus) {
    callback.call(context)
    } else {
      document.addEventListener('plusready', callback.bind(context))
    }
  }
Vue.mixin({beforeCreate () {
  onPlusReady(() => {
    this.plusReady = true
    }, this
  )},
  methods: {
    onPlusReady: onPlusReady,
    },
  })
window.eventBus = new Vue()
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  i18n,
  Back,
  store,
  components: { App },
  template: '<App/>'
})
